package com.sysmind.ravi.margin.service.impl;

import java.util.List;

import com.sysmind.ravi.margin.dao.OrderDao;
import com.sysmind.ravi.margin.dao.impl.OrderDaoImpl;
import com.sysmind.ravi.margin.model.Order;
import com.sysmind.ravi.margin.model.Stock;
import com.sysmind.ravi.margin.model.User;
import com.sysmind.ravi.margin.service.OrderService;

public class OrderServiceImpl implements OrderService
{	OrderDao orderDao = null;

	@Override
	public boolean addOrder(Order order, Stock stock, User user) 
	{	orderDao =  new OrderDaoImpl();
		boolean result = orderDao.addOrder(order, stock, user);
		orderDao = null;
		// TODO Auto-generated method stub
		return result;
	}

	@Override
	public List<Order> getAllOrders(User user)
	{	orderDao =  new OrderDaoImpl();
		List<Order> orders = orderDao.getAllOrders(user);
		//orderDao = null;
		// TODO Auto-generated method stub
		return orders;
	}

	@Override
	public List<Order> getAllOrders(User user, Stock stock)
	{	orderDao =  new OrderDaoImpl();
		List<Order> orders = orderDao.getAllOrders(user, stock);
		orderDao = null;
		// TODO Auto-generated method stub
		return orders;
	}

	@Override
	public int getNumRows(User user, Stock stock)
	{	orderDao =  new OrderDaoImpl();
		int  result = orderDao.getNumRows(user, stock);
		orderDao = null;
		// TODO Auto-generated method stub
		return result;
		// TODO Auto-generated method stub
		
	}

	@Override
	public int getNumRows(User user) 
	{	orderDao =  new OrderDaoImpl();
		int  result = orderDao.getNumRows(user);
		orderDao = null;
		// TODO Auto-generated method stub
		return result;		
	}

}
